/*
 * Main.cpp - Stack Example - using the Stack template class
 *
 *  Created on: Mar 7, 2013
 *      Author: Anthony Varghese
 */

#include <iostream>

#include "Stack.cpp" // OK because we are using templates

using std::cin;
using std::cout;
using std::endl;
using SavitchStack::Stack;

int main(){
	cout << "CSIS 237 Lecture 20 - Stacks" << endl;
    char next, ans;

    do {
        Stack<char> s;
        cout << "Enter a line of text:     ";
        cin.get(next);
        while (next != '\n') {
            s.push(next);
            cin.get(next);
        }

        cout << "Written backward that is: ";
        while ( ! s.isEmpty( ) )
            cout << s.pop( );
        cout << endl;

        cout << "Again?(y/n): ";
        cin >> ans;
        cin.ignore(10000, '\n');
    }while (ans != 'n' && ans != 'N');
}
